package de.voichie.android.wordthous;

import java.text.DecimalFormat;

import de.voichie.android.wordthous.data.DataManager;
import de.voichie.android.wordthous.data.ScreenResolution;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;

public class startup extends Activity {
	
	//-- Constants ------------------------------

    private static final int ACTIVITY_START_GAME = 0;
	
	
	private DataManager dataManager;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        initDataManager ();
        
        findViewById(R.id.start_new_game)
        .setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                startNewGame();
            }
        });
        
        
        
    }
    
    private void startNewGame() {
        Intent i = new Intent(this, FieldActivity.class);
        startActivityForResult(i, ACTIVITY_START_GAME);
    }
    
    private void initDataManager () {
    	this.dataManager = new DataManager();
    	dataManager.setScreenResolution(detectScreenResolution ());
    }
    
    private ScreenResolution detectScreenResolution () {
    	Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    	
    	int width = display.getWidth();
    	int height = display.getHeight();
    	
    	return new ScreenResolution(width, height);
    }
    
}